<template>
  <div class="demo">
    <button @click="sendStudent">传递学生</button>
    <button @click="unBind">解绑 abtguigu 事件</button>
    <ul>
      <li v-for="stu in students" :key="stu.id">
        姓名：{{stu.name}}，年龄：{{stu.age}} 
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name:"Student",
  data() {
    return {
      students:[
        {id:'01',name:'lisi',age:18},
        {id:'02',name:'wangwu',age:28},
        {id:'03',name:'tom',age:23},
        {id:'04',name:'jerry',age:22}
      ]
    }
  },
  methods: {
    sendStudent() {
      this.$emit('antguigu',this.students)
    },
    unBind() {
      // 解绑所有自定义事件
      // this.$off()
      // 解绑单个自定义事件
      // this.$off('antguigu')
      // 解绑多个自定义事件
      this.$off(['antguigu'])
    }
  },
}
</script>


<style scoped>
  .demo {
    background-color: skyblue;
  }
</style>